const box = document.getElementsByClassName("box")[0];
const boxStyle = getComputedStyle(box);

box.addEventListener("mousedown", function (event) {
	const x = event.pageX - box.offsetLeft;
	const y = event.pageY - box.offsetTop;

	function move(e) {
		box.style.top = e.pageY - y + "px";
		box.style.left = e.pageX - x + "px";
	}
	document.addEventListener("mousemove", move);

	box.addEventListener("mouseup", function () {
		document.removeEventListener("mousemove", move);
	});
});
